package com.ceba.test.base.dbdata.modules;
import com.ceba.base.dbdata.DataTableObject;
import com.ceba.base.dbdata.MysqlUtils;
public class EmailsDb {

	public static void init() throws Exception{
		//22-start
		DataTableObject msg_mail=new DataTableObject("msg_mail");
		msg_mail.addField("ID", "varchar(32)", "NOT NULL", "", "true");
		msg_mail.addField("USER_ID", "varchar(32)", "DEFAULT NULL", "", "false");
		msg_mail.addField("MAIL", "varchar(100)", "DEFAULT NULL", "", "false");
		msg_mail.addField("NAME", "varchar(100)", "DEFAULT NULL", "", "false");
		msg_mail.addField("SMTP", "varchar(100)", "DEFAULT NULL", "", "false");
		msg_mail.addField("CONTENT", "longtext", "DEFAULT NULL", "邮箱的个人签名(html)", "false");
		msg_mail.addField("PASSWORD", "varchar(100)", "DEFAULT NULL", "", "false");
		MysqlUtils.syncTableStructure(msg_mail);
		//end
		
		
		//23-start
		DataTableObject msg_mail_send=new DataTableObject("msg_mail_send");
		msg_mail_send.addField("ID", "varchar(32)", "NOT NULL", "", "true");
		msg_mail_send.addField("NAME", "varchar(512)", "DEFAULT NULL", "", "false");
		msg_mail_send.addField("EMAIL", "varchar(512)", "DEFAULT NULL", "", "false");
		msg_mail_send.addField("CREATE_USER", "varchar(512)", "DEFAULT NULL", "", "false");
		msg_mail_send.addField("CREATE_TIME", "datetime", "DEFAULT NULL", "", "false");
		MysqlUtils.syncTableStructure(msg_mail_send);
		//end

		
		//24-start
		DataTableObject msg_mail_set=new DataTableObject("msg_mail_set");
		msg_mail_set.addField("ID", "varchar(32)", "NOT NULL", "", "true");
		msg_mail_set.addField("CALL_NAME", "varchar(255)", "DEFAULT NULL", "默认称呼", "false");
		msg_mail_set.addField("TITLE", "varchar(255)", "DEFAULT NULL", "标题", "false");
		msg_mail_set.addField("CONTEXT_TEMPLATE", "text", "DEFAULT NULL", "内容模板", "false");
		msg_mail_set.addField("EMAIL_NAME", "varchar(516)", "DEFAULT NULL", "定义名称", "false");
		msg_mail_set.addField("EMAIL_TYPE", "varchar(32)", "DEFAULT '1'", "邮件类型1-普通 2-用户发送类型", "false");
		msg_mail_set.addField("CREATE_USER", "varchar(32)", "DEFAULT NULL", "", "false");
		msg_mail_set.addField("CREATE_TIME", "datetime", "DEFAULT NULL", "", "false");
		msg_mail_set.addField("UPDATE_TIME", "datetime", "DEFAULT NULL", "", "false");
		msg_mail_set.addField("UPDATE_USER", "varchar(32)", "DEFAULT NULL", "", "false");
		MysqlUtils.syncTableStructure(msg_mail_set);
		//end
		
		insertDefaultData();
	}
	
	public static void insertDefaultData() throws Exception {
		MysqlUtils.insertDataIntoTable("msg_mail","(`ID`,`USER_ID`,`MAIL`,`NAME`,SMTP`,`CONTENT`,`PASSWORD`)","ID","1","'1','ceba','ceba@quceba.com','上海测吧信息技术有限公司','smtphm.qiye.163.com','y7r4tOWI47erS/ZoWpMtiQ=='");
		MysqlUtils.insertDataIntoTable("msg_mail_set","(`ID`,`CALL_NAME`,`TITLE`,`CONTEXT_TEMPLATE`,`EMAIL_NAME`,`EMAIL_TYPE`,`CREATE_TIME`,`CREATE_USER`,`UPDATE_USER`,`UPDATE_TIME`)","ID","9","'9', null, null, '<!DOCTYPE html><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><title>#TITLE#</title></head><body style=\"font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;font-size: 14px;\"><div style=\"margin-left:10px;\"><div style=\"line-height:28px;padding-bottom:10px;padding-left:20px;\"><p style=\"text-indent:28px;\">#STORAGE_EMAIL_HONORIFIC# #STORAGE_EMAIL_USER#:</p><div style=\"width: 380px; text-indent: 28px; margin-left: 28px;\">#STORAGE_EMAIL_CONTENT1#</div><div style=\"width: 380px; text-indent: 28px; margin-left: 28px;\">#STORAGE_EMAIL_CONTENT2#</div><br/><p style=\"text-indent:35px;\"><hr></p><br/><p style=\"text-indent:28px;\">#ADMIN_HTML#</p></div></div></body></html>', null, '8', NULL, NULL, NULL, NULL");
	}
}
